from django.test import TestCase

# Create your tests here.
from bs4 import BeautifulSoup
import emoji
import re

content_html = """ 
<head><style>img{max-width:360.000000 !important;height:auto}</style></head><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px '.AppleSimplifiedChineseFont'; color: #000000}
span.s1 {font-family: '.PingFangSC-Regular'; font-weight: normal; font-style: normal; font-size: 17.00px}
span.s2 {font-family: '.AppleColorEmojiUI'; font-weight: normal; font-style: normal; font-size: 17.00px}
</style>
</head>
<body>
<p class="p1"><span class="s1">&#x4F60;&#x4EEC;&#x7684;&#x670B;&#x53CB;&#x90FD;&#x8BF4;&#x8FC7;&#x4F60;&#x4F1A;&#x6709;&#x673A;&#x4F1A;&#x53BB;&#x4E86;&#x89E3;&#x81EA;&#x5DF1;&#x5427;&#xFF01;&#x4F60;&#x8BF4;&#x5565;&#x5C31;&#x4E0D;&#x77E5;&#x9053;&#x4E3A;&#x4EC0;&#x4E48;&#x8FD9;&#x4E48;&#x559C;&#x6B22;&#x4E86;&#x597D;&#x4E45;&#x4E0D;&#x89C1;&#x7684;&#x65F6;&#x5019;&#x624D;&#x80FD;&#x627E;&#x5230;&#x81EA;&#x5DF1;&#x559C;&#x6B22;&#x7684;&#x4EBA;&#x4E86;&#xFF1F;&#x8BF4;&#x4E86;&#x5417;&#xFF01;&#x4F60;&#x662F;&#x4EC0;&#x4E48;&#x795E;&#x4ED9;&#x59D0;&#x59B9;&#x4E00;&#x8D77;&#x8D70;&#x8FC7;&#x4EBA;&#x751F;&#x7B2C;&#x4E00;&#xFF01;&#x6211;&#x60F3;</span><span class="s2">&#x26BD;&#xFE0F;&#x1F3BE;</span></p>
</body>
</html>


"""

content_text = BeautifulSoup(content_html, features="html.parser").text
print(content_text)
text = emoji.demojize(content_text)

result = re.sub(':\S+?:', ' ', text)
print(result)